/**
 * 
 */
package cii_lib_graph.elements;

import javax.swing.JToggleButton;

import cii_lib.CCII_CONFIG_TABLE;
import cii_lib.CCII_TABLE_INDEX;
import cii_lib.CIIlib;

/**
 * @author pdrabik
 * 
 */
public class GciiToggleButton extends JToggleButton {

	/**
	 * 
	 */
	public GciiToggleButton() {
		super();
	}

	/**
	 * 
	 */
	private static final long serialVersionUID = 101L;

	private int bitPosition = 0;

	private CCII_CONFIG_TABLE tContent = null;

	/**
	 * 
	 * @return This bit possiotion among other bits from group
	 */
	public int getPosition() {
		return bitPosition;
	}

	public void setPosition(int bitPosition) {
		this.bitPosition = bitPosition;
	}

	public CCII_CONFIG_TABLE getContent() {
		return tContent;
	}

	public void setContent(CCII_CONFIG_TABLE content) {
		tContent = content;
		if (content.Access == CIIlib.TABLE_ACCESS.RO
				|| content.Access == CIIlib.TABLE_ACCESS.RC
				|| content.Access == CIIlib.TABLE_ACCESS.NA)
			setEnabled(false);
		setToolTipText("<html><body bgcolor=\"#FBEC5D\"><table width=110><tr><td bgcolor=\"blue\"><font color=\"#FFFF00\">"
				+ "<b>" + content.Name + "</b>"
				+ "</font></td></tr></table><b>Access: "
				+ content.Access
				+ "</b><br>Address: "
				+ content.Address+ ":"+ content.Position 
				+ "</body></html>");
	}

	@Override
	public void setSelected(boolean b) {
		// TODO Auto-generated method stub
		super.setSelected(b);
	}

}
